<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jspf/must/basePath.jspf" %>
<!--后台UI组件Start-->
<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI.jspf" %>
<%--<%@include file="/WEB-INF/jspf/zj/ligerui/LigerUI_form.jspf" %>--%>
<!--后台UI组件End-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script src="dc_manager/base/refectory/fl/js/refectoryfl_treeMenu.js" type="text/javascript"></script>
        <script type="text/javascript">
//-------------------------------全局变量-------------------------------------------------
            var UPDATE;
            var GRID;
            var ADD;
            $(function () {
                f_dc_base_refectoryfl_menuTree("divID_Tree", f_refectoryfl_choose);
                GRID = $("#divID_GRID").ligerGrid({
                    columns: [
                        , {display: '编号', name: 'refectory_code', width: 90, align: 'left'}
                        , {display: '名称', name: 'refectory_name', width: 90, align: 'left'}
                        , {display: '说明', name: 'refectory_info', width: 90, align: 'left'}
                        , {display: 'id', name: 'refectory_id', hide: true}
                        , {display: 'flid', name: 'flid', hide: true}
                    ]
                    , usePager: false
                    , url: 'weixinkeji/dev/dc/base/refectory/s/manager.imy'
                    , width: '500'
                    , height: '97%'
//                    , onSelectRow: f_foodimgManager
                });
                $("#toptoolbar").ligerToolBar({items: [
                        {text: '增加', click: add}
                        , {line: true}
                        , {text: '修改', click: update}
                        , {line: true}
                        , {text: '删除', click: dell}
                    ]});
            });
//-------------------------------GRID列函数-----------------------------------------------
            //左树查询
            function f_refectoryfl_choose(d, terget) {
                GRID.setParm("flid", getMyNodeID("flid", d.data));
                GRID.reload();
            }
//-------------------------------增删改操作-----------------------------------------------
            function add() {
                ADD = openURL_Event("添加", ADD, "dc_manager/base/refectory/refectory_A.jsp", 400, 900, f_d);
                ADD.max();
                function f_d() {
                    ADD = null;
                    GRID.reload();
                }
            }
            function update() {
                var row = GRID.getSelectedRow();
                if (!row) {
                    msg_tip("错误", "请选择行");
                    return;
                } else if (row.refectory_id.length > 10) {
                    UPDATE = openURL_Event("修改", UPDATE, "weixinkeji/dev/dc/base/refectory/adu/update.imy?id=" + row.refectory_id, 400, 900, f_d);
                    UPDATE.max();
                }
                function f_d() {
                    UPDATE = null;
                    GRID.reload();
                }
            }
            function dell() {
                var rows = GRID.getSelectedRows();
                var ids = "";
                for (var i = 0; i < rows.length; i++) {
                    ids = ids + "," + rows[i].refectory_id;
                }
                ids = ids.substring(1);
                if (rows.length < 1) {
                    msg_tip("操作提示", "请选择行", 200, 50);
                    return;
                } else {

                    if (post_json("weixinkeji/dev/dc/base/refectory/adu/dell.imy", {"id": ids}, 400, 200)) {
                        GRID.reload();
                    }
                }
            }
        </script>
    </head>
    <body>  
        <div id="divID_Tree" style="float: left;width: 200px"></div>
        <div>
            <div id="toptoolbar"></div> 
            <div>

                <div id="divID_GRID" style="float: left"></div>
            </div>
        </div>
    </body>
</html>
